<template>
  <div class="main-page">
    <el-form ref="form">
      <!-- 搜索栏 -->
      <BaseSearchBar v-on:ChildSearchEvent="getSearchGenceralCustList"></BaseSearchBar>
    </el-form>
    <!-- 表单 -->
    <el-card :body-style="{ padding: '0px' }" class="box-card">
      <div class="tableStyle">
        <Bluetable
			:tHead="tHead"
			:tData="tableData"
			ref="blueTable"
			@operateClick="operateClick">
		</Bluetable>
		<pagination
			:total="query.total"
			:page.sync="query.page"
			:limit.sync="query.limit"
			@pagination="getList"/>
      </div>
    </el-card>
	<!-- 剂量 -->
	<JlDialog ref="jlDialog" :dataObj="jlData" @changeFun="getList"></JlDialog>
	<!-- 相互作用 -->
	<xhzyDialog ref="xhzyDialog" :dataObj="xhzyData" @changeFun="getList"></xhzyDialog>
	<!-- 体外配伍 -->
	<twpwDialog ref="twpwDialog" :dataObj="twpwData" @changeFun="getList"></twpwDialog>
	<!-- 超适应症 -->
	<csyzDialog ref="csyzDialog" :dataObj="csyzData" @changeFun="getList"></csyzDialog>
	<!-- 儿童 -->
	<etDialog ref="etDialog" :dataObj="etData" @changeFun="getList"></etDialog>
	<!-- 成人 -->
	<crDialog ref="crDialog" :dataObj="crData" @changeFun="getList"></crDialog>
	<!-- 老人 -->
	<lrDialog ref="lrDialog" :dataObj="lrData" @changeFun="getList"></lrDialog>
	<!-- 妊娠 -->
	<rsDialog ref="rsDialog" :dataObj="rsData" @changeFun="getList"></rsDialog>
	<!-- 性别 -->
	<xbDialog ref="xbDialog" :dataObj="xbData" @changeFun="getList"></xbDialog>
	<!-- 给药途径 -->
	<gytjDialog ref="gytjDialog" :dataObj="gytjData" @changeFun="getList"></gytjDialog>
	<!-- 重复用药 -->
	<cfyyDialog ref="cfyyDialog" :dataObj="cfyyData" @changeFun="getList"></cfyyDialog>
	<!-- 药物禁忌症 -->
	<ywjjzDialog ref="ywjjzDialog" :dataObj="ywjjzData" @changeFun="getList"></ywjjzDialog>
	<!-- 不良反应 -->
	<blfyDialog ref="blfyDialog" :dataObj="blfyData" @changeFun="getList"></blfyDialog>
	<!-- 配伍浓度 -->
	<pwndDialog ref="pwndDialog" :dataObj="pwndData" @changeFun="getList"></pwndDialog>
	<!-- 抗菌药三联重复用药 -->
	<kjyslcfyyDialog ref="kjyslcfyyDialog" :dataObj="kjyslcfyyData" @changeFun="getList"></kjyslcfyyDialog>
	<!-- 哺乳用药 -->
	<bryyDialog ref="bryyDialog" :dataObj="bryyData" @changeFun="getList"></bryyDialog>
	<!-- 围术期用药 -->
	<wsqyyDialog ref="wsqyyDialog" :dataObj="wsqyyData" @changeFun="getList"></wsqyyDialog>
	<!-- 肝损害 -->
	<gshDialog ref="gshDialog" :dataObj="gshData" @changeFun="getList"></gshDialog>
  </div>
</template>

<script>
import BaseSearchBar from "./components/BaseSearchBar";
import JlDialog from "./components/jlDialog";
import xhzyDialog from "./components/xhzyDialog";
import twpwDialog from "./components/twpwDialog";
import csyzDialog from "./components/csyzDialog";
import etDialog from "./components/etDialog";
import crDialog from "./components/crDialog";
import lrDialog from "./components/lrDialog";
import rsDialog from "./components/rsDialog";
import xbDialog from "./components/xbDialog";
import gytjDialog from "./components/gytjDialog";
import cfyyDialog from "./components/cfyyDialog";
import ywjjzDialog from "./components/ywjjzDialog";
import blfyDialog from "./components/blfyDialog";
import pwndDialog from "./components/pwndDialog";
import kjyslcfyyDialog from "./components/kjyslcfyyDialog";
import bryyDialog from "./components/bryyDialog";
import wsqyyDialog from "./components/wsqyyDialog";
import gshDialog from "./components/gshDialog";
import getMultiConditionList from "@/api/rad";
export default {
  components: {
    BaseSearchBar,
	JlDialog,
	xhzyDialog,
	twpwDialog,
	csyzDialog,
	etDialog,
	crDialog,
	lrDialog,
	rsDialog,
	xbDialog,
	gytjDialog,
	cfyyDialog,
	ywjjzDialog,
	blfyDialog,
	pwndDialog,
	kjyslcfyyDialog,
	bryyDialog,
	wsqyyDialog,
	gshDialog
  },
  created: function () {
    this.getList();
  },
  data () {
    return {
      queryInfo: {
        srm: "",
        i_define: "",
      },
  	  query: {
  	    total: 0,
  	    page: 1,
  	    limit: 10
  	  },
      tHead: [
      	
        {
          prop: "drugCode",
		  label: "医院药品编码",
		  width:"100"
        },
        {
          prop: "drugName",
		  label: "医院药品名称",
		  width:"150"
        },
		{
		  label: "操作(按钮蓝色表示有通用自定义)",
		  cusoperate:{
			has:"2,3",
			btns:[
				{
				  value: "dosageDefine",
				  label: "剂量"
				},
				{
				  value: "interDefine",
				  label: "相互作用"
				},
				{
				  value: "ivDefine",
				  label: "体外配伍"
				},
				{
				  value: "indicaDefine",
				  label: "超适应症"
				},
				{
				  value: "pediatricDefine",
				  label: "儿童"
				},
				{
				  value: "adultDefine",
				  label: "成人"
				},
				{
				  value: "geriatricDefine",
				  label: "老人"
				},
				{
				  value: "pregnancyDefine",
				  label: "妊娠"
				},
				{
				  value: "sexDefine",
				  label: "性别"
				},
				{
				  value: "routeDefine",
				  label: "给药途径"
				},
				{
				  value: "dupIngGenDefine",
				  label: "重复用药"
				},
				{
				  value: "contrScrDefine",
				  label: "药物禁忌症"
				},
				{
				  value: "reactionDefine",
				  label: "不良反应"
				},
				{
				  value: "compatibilityDefine",
				  label: "配伍浓度"
				},
				{
				  value: "anitDupIngGenDefine",
				  label: "抗菌药物三联重复用药"
				},
				{
				  value: "breastfeedingDefine",
				  label: "哺乳用药"
				},
				{
				  value: "preOperationDefine",
				  label: "围术期用药"
				},
				{
				  value: "liverDamageDefine",
				  label: "肝损害剂量"
				},
				{
				  value: "renalDamageDefine",
				  label: "肾损害剂量"
				}
			],
			activeColor:"#409EFF"
		  },
		  width:"1600px",
		  align:"left"
		},
      ],
      tableData: [],
	  jlData:{},
	  xhzyData:{},
	  twpwData:{},
	  csyzData:{},
	  etData:{},
	  crData:{},
	  lrData:{},
	  rsData:{},
	  xbData:{},
	  gytjData:{},
	  cfyyData:{},
	  ywjjzData:{},
	  blfyData:{},
	  pwndData:{},
	  kjyslcfyyData:{},
	  bryyData:{},
	  wsqyyData:{},
	  gshData:{}
    };
  },
  methods: {
	  operateClick (val,item) {
	  	if(val.label == "剂量"){
			this.jlData=item;
	  		this.$refs.jlDialog.show();
	  	}else if(val.label == "相互作用"){
	  		this.xhzyData=item;
	  		this.$refs.xhzyDialog.show();
	  	}else if(val.label == "体外配伍"){	
			this.twpwData=item;
			this.$refs.twpwDialog.show();
	  	}else if(val.label == "超适应症"){
	  		this.csyzData=item;
	  		this.$refs.csyzDialog.show();
	  	}else if(val.label == "儿童"){
	  		this.etData=item;
	  		this.$refs.etDialog.show();
	  	}else if(val.label == "成人"){
	  		this.crData=item;
	  		this.$refs.crDialog.show();
	  	}else if(val.label == "老人"){
	  		this.lrData=item;
	  		this.$refs.lrDialog.show();
	  	}else if(val.label == "妊娠"){
	  		this.rsData=item;
	  		this.$refs.rsDialog.show();
	  	}else if(val.label == "性别"){
	  		this.xbData=item;
	  		this.$refs.xbDialog.show();
	  	}else if(val.label == "给药途径"){
	  		this.gytjData=item;
	  		this.$refs.gytjDialog.show();
	  	}else if(val.label == "重复用药"){
	  		this.cfyyData=item;
	  		this.$refs.cfyyDialog.show();
	  	}else if(val.label == "药物禁忌症"){
	  		this.ywjjzData=item;
	  		this.$refs.ywjjzDialog.show();
	  	}else if(val.label == "不良反应"){
	  		this.blfyData=item;
	  		this.$refs.blfyDialog.show();
	  	}else if(val.label == "配物浓度"){
	  		this.pwndData=item;
	  		this.$refs.pwndDialog.show();
	  	}else if(val.label == "抗菌药物三联重复用药"){
			this.kjyslcfyyData=item;
			this.$refs.kjyslcfyyDialog.show();
	  	}else if(val.label == "哺乳用药"){
	  		this.bryyData=item;
	  		this.$refs.bryyDialog.show();
	  	}else if(val.label == "围术期用药"){
			this.wsqyyData=item;
			this.$refs.wsqyyDialog.show();
	  	}else if(val.label == "肝损害剂量"){
	  		this.gshData=item;
	  		this.$refs.gshDialog.show();
	  	}else if(val.label == "肾损害剂量"){
	  		
	  	}
	  },
	async getList() {
		let _this = this;
		let res = await this.$rad.getMultiConditionList({
			srm: _this.queryInfo.srm,
			i_define: _this.queryInfo.i_define,
			page: _this.query.page,
			pageSize: _this.query.limit,
		})
		this.tableData = res.rows
		this.query.total = res.total
		// console.log(this.total)
	},
	getSearchGenceralCustList(data) {
		this.queryInfo.srm = data.srm;
		this.queryInfo.i_define = data.i_define;
		this.query.pagesize=1;
		this.getList()
	},
  },
  
};
</script>
<style scoped>
.el-card {
  margin-left: 3px;
}
.SearchT {
  display: flex;
  justify-content: flex-end;
  height: 40px;
  align-items: center;
  background-color: #e6edf3;
  font-size: 14px;
}
.tableLable {
  flex: 1;
  text-align: left;
  margin-left: 15px;
  letter-spacing: 2px;
  font-size: 14px;
  color: #32a6f3;
  font-weight: bold;
}
/* .exportBtn {
  margin-right: 23px;
}
.BatchDeleBtn {
  margin-right: 15px;
} */
.tableStyle {
  width: 100%;
  height: 100%;
}
.card-table {
  width: 100%;
  height: 75%;
}
.block {
  text-align: center;
  margin-top: 12px;
  margin-bottom: 12px;
}
.Btn {
  display: flex;
  flex: 1;
  flex-wrap: nowrap;
}
</style>
